function throttle(fn, time = 1000) {
    let timer;
    return function (...args) {
        if (timer == null) {
            fn.apply(this, args);
            timer = setTimeout(() => {
                timer = null;
            }, time)
        }
    }
}

const btn = document.getElementById('btn');
const circle = document.getElementById('circle')


btn.onclick = throttle(function (e) {
    circle.innerHTML = parseInt(circle.innerHTML) + 1;
    circle.className = 'fade';
    setTimeout(() => circle.className = '', 500);
});